﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ddcCajamarca.BusinessEntities.Post;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace ddcCajamarca.Repository.Mapping
{
    public class NotaInformativaMap : EntityTypeConfiguration<NotaInformativa>
    {

        public NotaInformativaMap()
        {
            this.HasKey(n => n.id);
            this.Property(n => n.id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(n => n.Titulo).IsRequired();
            this.Property(n => n.Subtitulo).IsRequired();
            this.Property(n => n.Texto).HasColumnType("text").IsRequired();
            this.Property(n => n.Fecha).IsOptional();
            this.Property(n => n.Imagen).IsRequired();

            this.HasRequired(n => n.evento).WithMany(e => e.Notainformativas).
                HasForeignKey(n => n.EventoId).WillCascadeOnDelete(false);

        }



    }
}
